package pl.bizuteria.sklep.admin.client.activity.earing;

import java.util.List;
import java.util.Set;
import java.util.logging.Logger;

import pl.bizuteria.sklep.admin.client.activity.bracelet.BraceletListActivity;
import pl.bizuteria.sklep.admin.client.activity.product.AbstractProxyListActivity;
import pl.bizuteria.sklep.admin.client.ui.product.IProxyListView;
import pl.bizuteria.sklep.api.shared.proxy.EaringProxy;
import pl.bizuteria.sklep.api.shared.request.ApplicationRequestFactory;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.view.client.Range;
import com.google.web.bindery.requestfactory.shared.Request;

public class EaringListActivity extends AbstractProxyListActivity<EaringProxy> {
	static Logger logger = Logger.getLogger(EaringListActivity.class.getName());
	public EaringListActivity(IProxyListView<EaringProxy> braceletView,
			PlaceController placeController, ApplicationRequestFactory requestFactory) {
		super(braceletView, placeController, EaringProxy.class , requestFactory);
	}

	
	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		super.start(panel, eventBus);
	}

	@Override
	protected Request<Void> createDeleteRequest(Set<EaringProxy> elements) {
		return requestFactory.earingRequest().remove(elements);
	}

	
	@Override
	protected Request<List<EaringProxy>> createFindRequest(Range range) {
		return requestFactory.earingRequest().findAll(range.getStart(), range.getLength());
	}


	@Override
	protected Request<Integer> createCountRequest() {
		return requestFactory.earingRequest().count();
	}


	@Override
	protected Logger logger() {
		return logger;
	}
	
}
